package com.dkd.day20250817;

import java.util.*;

public class lc002 {
    //字母异词分组
    public static void main(String[] args) {

    }

    public static List<List<String>> solve(String[] arr){
        String[] sort = Arrays.stream(arr).sorted().toArray(String[]::new);


        HashMap<String, ArrayList<String>> map = new HashMap<>();


        for (int i = 0; i < sort.length; i++) {
            if (map.containsKey(sort[i])) {
                map.get(sort[i]).add(arr[i]);
            }else{
                map.put(sort[i], new ArrayList<>());
            }
        }


        return new ArrayList<>(map.values());
    }
}
